using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using Newtonsoft.Json;

namespace SoftwareMonkeys.FileNodes
{
	public class FileNode
	{
		public Dictionary<string, string> Properties = new Dictionary<string, string>();
		
		[JsonProperty]
		public string Name { get;set; }
		
		[JsonIgnore]
		public string FilePath { get;set; }
		
		[JsonIgnore]
		public Dictionary<string, FileNode> Nodes = new Dictionary<string, FileNode>();

		[JsonIgnore]
		//[XmlIgnore]
		public FileNodeSaver Saver { get;set; }

		public FileNode(
			string filePath,
			FileNodeSaver saver
		)
		{
			FilePath = filePath;
			Saver = saver;
		}

		public void Save()
		{
			Saver.Save (this, FilePath);
		}
	}
}
